// import moment from 'moment'
const lodop = window.LODOP

// 获取打印机列表
export const getPrinterList = () => {
  const print = []
  const printLength = lodop.GET_PRINTER_COUNT()
  for (let i = 0; i < printLength; i++) {
    const obj = { value: i, checked: i === 0, label: lodop.GET_PRINTER_NAME(i) }
    print.push(obj)
  }
  return print
}

// 检查打印设置-指引单
export const checkZIndex = () => {}

// 检查打印设置-条码
export const checkQIndex = () => {}

// 打印条码
export const printQrcode = (index = 0) => {
  lodop.SET_PRINT_MODE('TRYLINKPRINTER_NOALERT', true)
  lodop.SET_LICENSES('', '', '', '')
  lodop.SET_PRINTER_INDEX(index)
  lodop.PRINT_INITA("0mm", "0mm", "50mm", "30mm", "qrcode")
  lodop.SET_PRINT_PAGESIZE("0mm", "0mm", "50mm", "30mm", "qrcode")
  lodop.SET_SHOW_MODE('BKIMG_IN_PREVIEW', true)
  lodop.SET_SHOW_MODE('BKIMG_PRINT', true)
  // lodop.ADD_PRINT_BARCODE()
  lodop.PREVIEW()
  // lodop.PRINT()
}
